package com.lib.base.utils.data

import android.content.Context
import com.lib.base.base.BaseApplication

object SPUtils {

    private const val SHARED_PRE = "SHARED_PRE"
    var sp = BaseApplication.appContext?.getSharedPreferences(SHARED_PRE, Context.MODE_PRIVATE)

    fun saveBoolean(key: String, value: Boolean) {
        sp?.edit()?.putBoolean(key, value)?.apply()
    }

    fun getBoolean(key: String, defValue: Boolean): Boolean {
        return sp?.getBoolean(key, defValue) ?: defValue
    }
}